package org.ourgrid.broker.business.scheduler.workqueue.xmlcreator;


public class RemoteExecuteXMLCreator implements XMLCreatorIF {
	
	
	/**
	 * <REMOTE_EXECUTE workerID='String' requestID='long' commands='String'>
	 *    1..n <ENV_VAR var='String'/> 
	 * </REMOTE_EXECUTE> 
	 */
	public String getXML(String workerID, long requestID, String commands, String[] envVars) {
		
		StringBuffer buffer = new StringBuffer();
		
		buffer.append("<REMOTE_EXECUTE ");
		buffer.append("workerID='" + workerID + "' ");
		buffer.append("requestID='" + requestID + "' ");
		buffer.append("commands='" + commands + "'> ");
		buffer.append(SEP);
		
		if (envVars != null) {
			for (String var : envVars) {
				buffer.append("<ENV_VAR var='" + var + "'/>" + SEP);
			}
		}
		
		buffer.append("</REMOTE_EXECUTE>");
		
		return buffer.toString();
	}
	
	

}
